
#include "infoid.h"

unsigned int iidClassNumber(EInfoId iid)
{
	return (unsigned int)iid / IID_CLASS_SIZE;
}


unsigned int iidSubNumber(EInfoId iid)
{
	return (unsigned int)iid % IID_CLASS_SIZE;
}

const char *iidClassString(EInfoId iid)
{
	static const char IC_GENERAL[]	 	= "general";
	static const char IC_GRAPHICS[]		= "graphics";
	static const char IC_SPATIAL[]		= "spatial";
	static const char IC_AREA[]			= "area";
	static const char IC_MECHANICAL[]	= "mechanical";
    static const char IC_ORGANISM[]		= "organism";
	static const char IC_PLANT[]		= "plant";
	static const char UNKNOWN[]			= "(unknown class)";
	switch((EInfoIdClass)iidClassNumber(iid))
	{
	case ic_General:
		return IC_GENERAL;
	case ic_Graphics:
		return IC_GRAPHICS;
	case ic_Spatial:
		return IC_SPATIAL;
	case ic_Area:
		return IC_AREA;
	case ic_Mechanical:
		return IC_MECHANICAL;
    case ic_Organism:
		return IC_ORGANISM;
	case ic_Plant:
		return IC_PLANT;
	default:
		return UNKNOWN;
	}
}


const char * iidString(EInfoId iid)
{
	static const char I_GEN_ENTITYID[] = "entityid";
	static const char I_GEN_TYPE[] = "type";
	/* graphical */
	/* spatial */
	static const char I_SPA_POSITION[] = "position";
	static const char I_SPA_SHAPE[] = "shape";
	/* area */
	static const char I_ARE_BEDROCK_HEIGHT[] = "bedrock height";
	static const char I_ARE_SOIL_HEIGHT[] = "soil height";
	static const char I_ARE_SOIL_ALTITUDE[] = "soil altitude";
	static const char I_ARE_SOIL_MUD[] = "soil mud";
	static const char I_ARE_WATER_HEIGHT[] = "water height";
	static const char I_ARE_WATER_ALTITUDE[] = "water altitude";
	static const char UNKNOWN[] = "(unknown infoid)";

	switch(iid)
	{
	/* general */
	case i_gen_EntityId:
		return I_GEN_ENTITYID;
	case i_gen_Type:
		return I_GEN_TYPE;
	/* graphical */
	/* spatial */
	case i_spa_Position:
		return I_SPA_POSITION;
	case i_spa_Shape:
		return I_SPA_SHAPE;
	/* area */
	case i_are_Bedrock_height:
		return I_ARE_BEDROCK_HEIGHT;
	case i_are_Soil_height:
		return I_ARE_SOIL_HEIGHT;
	case i_are_Soil_altitude:
		return I_ARE_SOIL_ALTITUDE;
	case i_are_Soil_mud:
		return I_ARE_SOIL_MUD;
	case i_are_Water_height:
		return I_ARE_WATER_HEIGHT;
	case i_are_Water_altitude:
		return I_ARE_WATER_ALTITUDE;
	default:
		return UNKNOWN;
	}
}
